import streamlit as st
from components import render_tool_cards

# from auth_jwt import verify_token
# from cookie_manager import get_cookie, clear_cookie
#
# token = get_cookie("token")
# username = verify_token(token) if token else None
#
# if username:
#     st.title(f"🎉 欢迎，{username}")
#     if st.button("退出登录"):
#         clear_cookie("token")
#         st.rerun()
# else:
#     st.warning("未登录，请先登录")
#     st.stop()

# 定义你的小工具们
tools = [
    {
        "name": "🖼️ Tensor可视化工具",
        "description": "Tensor张量可视化展示",
        "page_link": "Tensor可视化工具",
        "color": "#ff006a",
    },
    {
        "name": "🌟 学员辅导系统",
        "description": "学员辅导系统",
        "page_link": "学习辅导系统",
        "color": "#26c626",
    },
    {
        "name": "📊 表结构查询工具",
        "description": "数据库表结构查询工具",
        "page_link": "查询PGSQL表结构",
        "color": "#87CEFA",
    },
    {
        "name": "🧠 神经网络前向传播",
        "description": "演示神经网络的前向传播过程。",
        "page_link": "神经网络前向传播",
        "color": "#ff006a",
    },
    {
        "name": "🔖 二维码生成工具",
        "description": "二维码生成工具。",
        "page_link": "二维码生成器",
        "color": "#26c626",
    }, {
        "name": "🔎 PGSQL代码生成器",
        "description": "PGSQL代码生成器。",
        "page_link": "PGSQL代码生成器",
        "color": "#87CEFA",
    },
    {
        "name": "📈 Tensor自动求导",
        "description": "支持Tensor的自动求导展示和测试。",
        "page_link": "Tensor自动求导",
        "color": "#ff006a",
    },

    {
        "name": "🤖 RAG问答助手",
        "description": "RAG问答机器人,支持问答解读",
        "page_link": "RAG问答助手",
        "color": "#26c626",
    } ,{
        "name": "🔹 Word2Vec 词向量可视化",
        "description": "Word2Vec 词向量可视化",
        "page_link": "词向量可视化",
        "color": "#87CEFA",
    }, {
        "name": "💬 智能聊天问答系统",
        "description": "智能聊天问答系统",
        "page_link": "小加AI助理",
        "color": "#ff006a",
    }, {
        "name": "📋 AI文案写作助手",
        "description": "多阶段智能流程",
        "page_link": "AI文案写作助手",
        "color": "#26c626",
    },{
        "name": "🔹 redis 可视化工具",
        "description": "redis可视化工具",
        "page_link": "redis可视化工具",
        "color": "#87CEFA",
    }
]

# 渲染页面
st.set_page_config(page_title="工具中心", page_icon="🚀", layout="wide")
st.title("🚀 工具中心")
st.caption("作者：何双新 ｜ 技术栈：Python + LLM + Streamlit")
render_tool_cards(tools, columns=3)
st.caption("安徽智加数字科技有限公司 · 技术学习组出品 🚀")
